package com.lcxw.hxzb.friendcircle.project.system.controller;

import java.util.List;

import com.lcxw.hxzb.friendcircle.framework.web.controller.BaseController;
import com.lcxw.hxzb.friendcircle.framework.web.domain.AjaxResult;
import com.lcxw.hxzb.friendcircle.framework.web.page.TableDataInfo;
import com.lcxw.hxzb.friendcircle.project.system.domain.YwpdRank;
import com.lcxw.hxzb.friendcircle.project.system.service.IYwpdRankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 情侣等级Controller
 * 
 * @author ruoyi
 * @date 2020-09-27
 */
@RestController
@RequestMapping("/system/rank")
public class YwpdRankController extends BaseController
{
    @Autowired
    private IYwpdRankService ywpdRankService;

    /**
     * 查询情侣等级列表
     */
    @GetMapping("/list")
    public TableDataInfo list(YwpdRank ywpdRank)
    {
        startPage();
        List<YwpdRank> list = ywpdRankService.selectYwpdRankList(ywpdRank);
        return getDataTable(list);
    }

    /**
     * 获取情侣等级详细信息
     */
    @GetMapping(value = "/{rankId}")
    public AjaxResult getInfo(@PathVariable("rankId") Long rankId)
    {
        return AjaxResult.success(ywpdRankService.selectYwpdRankById(rankId));
    }

    /**
     * 新增情侣等级
     */
    @PostMapping
    public AjaxResult add(@RequestBody YwpdRank ywpdRank)
    {
        return toAjax(ywpdRankService.insertYwpdRank(ywpdRank));
    }

    /**
     * 修改情侣等级
     */
    @PutMapping
    public AjaxResult edit(@RequestBody YwpdRank ywpdRank)
    {
        return toAjax(ywpdRankService.updateYwpdRank(ywpdRank));
    }

    /**
     * 删除情侣等级
     */
	@DeleteMapping("/{rankIds}")
    public AjaxResult remove(@PathVariable Long[] rankIds)
    {
        return toAjax(ywpdRankService.deleteYwpdRankByIds(rankIds));
    }
}
